package com.task.core.mapper;

import java.util.List;

import com.task.core.vo.resp.DatasourceDetailRespVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.task.common.domain.info.KeyAndValue;
import com.task.core.domain.DatasourceInfo;
import com.task.core.domain.info.RelationMissionSourceInfo;
import com.task.core.dto.request.DatasourceOptionRequestDTO;
import com.task.core.dto.request.DatasourceRequestDTO;

/**
 * @author 迪迦.
 * @date 2024/11/4 17:30
 */
@Mapper
public interface DatasourceMapper {

  List<DatasourceInfo> getDatasourceByPage(DatasourceRequestDTO request);

  DatasourceInfo getDatasourceByCode(String code);

  List<KeyAndValue> getDatasourceForOption(DatasourceRequestDTO request);

  void addDatasource(DatasourceRequestDTO request);

  Integer modifyDatasource(DatasourceRequestDTO request);

  Integer deleteDatasource(@Param("code") String datasourceCode, @Param("userId") Long userId);

  void updateDataCount(@Param("intValue") Integer intValue, @Param("dataSourceCode") String dataSourceCode);

  void updateDataCountDecrement(@Param("datasourceCode") String datasourceCode, @Param("deleteCount") Integer deleteCount);

  List<DatasourceInfo> getDataSourceByCodes(@Param("codes") List<String> codes);

  void deleteDatasourceByMissionCode(@Param("missionCode") String missionCode);

  void addSourceByMissionCode(@Param("sourceInfos") List<RelationMissionSourceInfo> sourceInfos);

  List<DatasourceInfo> getDatasourceForOptionByMission(DatasourceOptionRequestDTO request);

  void deleteMissionDatasourceRelation(String datasourceCode);

  void deleteRelationMissionSourceUseDataCount(String datasourceCode);

    List<DatasourceInfo> getAllDataSource(DatasourceOptionRequestDTO request);

  void updateDataSourceCount(@Param("datasourceCode") String datasourceCode,@Param("userId") Long userId);

  DatasourceDetailRespVo getDataSoucreDetail(DatasourceRequestDTO datasourceRequestDTO);
}
